package cn.pconline.autoclub.web;

import cn.pconline.autoclub.service.CacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * TODO 批量清缓存操作不在resin窗口里面做，改在定时任务做
 * @author 作者 guoqiang
 * @version 2014-5-8 定时任务调用接口清理车友会缓存
 */
@Controller
public class CacheController {

    @Autowired
    private CacheService cacheService;

    /**
     * 清除车友会对象表缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_club")
    @ResponseBody
    public String initClub() {
        cacheService.initClubCache();
        return "";
    }

    /**
     * 清除车友会用户缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_user")
    @ResponseBody
    public String initUser() {
        cacheService.initUserCache();
        return "";
    }

    /**
     * 清除会员油值记录缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_member_stat")
    @ResponseBody
    public String initMemberStat() {
        cacheService.initMemberStat();
        return "";
    }

    /**
     * 清除车友会油值记录缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_petroldaily_stat")
    @ResponseBody
    public String initClubDailyStat() {
        cacheService.initClubDailyStat();
        return "";
    }

    /**
     * 清除认证人数记录缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_total_member")
    @ResponseBody
    public String initToalMember() {
        cacheService.initToalMember();
        return "";
    }

    /**
     * 清除会员信息缓存
     *
     * @return
     */
    @RequestMapping("/util/daily/clear_member_info")
    @ResponseBody
    public String initMemberInfo() {
        cacheService.initMemberInfo();
        return "OK";
    }
}
